import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_module/pages/mine/mine_page.dart';
import 'package:flutter_module/pages/root_page/language_setting.dart';
import 'package:flutter_module/pages/root_page/root_page.dart';
import 'package:flutter_module/pages/root_page/theme_setting.dart';
import 'package:flutter_module/widget/u_webview.dart';

class RouteGet {
  ///root page
  static const String homePage = "homePage";
  static const String web = "web";
  static const String navigationPage = "navigationPage";
  static const String themeSettingPage = "themeSettingPage";
  static const String languageSettingPage = "languageSettingPage";

  ///使用了flutter_boost，getX相关的路由配置就不使用
  ///getx的使用
  ///https://github.com/jonataslaw/getx/blob/master/documentation/zh_CN/route_management.md
  ///GetX 的集成和主要功能：状态管理、依赖管理、路由管理的使用都已经实现了，可以开始项目开发了
  ///
  ///pages map
  // static final List<GetPage> getPages = [
  //   //定义别名  页面    映射关系
  //   GetPage(name: mine, page: () => MinePage(), binding: MineBinding()),///这里使用的 Bindings  的方式，会自动在 Binding 里注册 Controller ， 并且在 Page 里生成 find Controller 的代码。
  //   GetPage(
  //       name: web,
  //       page: () => UWebView()),
  //       // page: () => UWebView(),binding: WebBinding()),
  // ];

  /// flutter_boost:配置路由
  static final Map<String, FlutterBoostRouteFactory> routerMap = {
    RouteGet.homePage: (settings, uniqueId) {
      return PageRouteBuilder<dynamic>(
          settings: settings, pageBuilder: (_, __, ___) => MinePage(params: settings.arguments as Map<dynamic, dynamic>));
    },

    RouteGet.web: (settings, uniqueId) {
      return PageRouteBuilder<dynamic>(
          settings: settings, pageBuilder: (_, __, ___) => UWebView(params: settings.arguments as Map<dynamic, dynamic>));
    },

    RouteGet.navigationPage: (settings, uniqueId) {
      return PageRouteBuilder<dynamic>(
          settings: settings, pageBuilder: (_, __, ___) => RootPage(params: settings.arguments as Map<dynamic, dynamic>));
    },

    RouteGet.themeSettingPage: (settings, uniqueId) {
      return PageRouteBuilder<dynamic>(
          settings: settings, pageBuilder: (_, __, ___) => ThemeSettingPage());
    },

    RouteGet.languageSettingPage: (settings, uniqueId) {
      return PageRouteBuilder<dynamic>(
          settings: settings, pageBuilder: (_, __, ___) => LanguageSettingPage());
    },
  };
}